package com.hongyu.smart.village.ui.base;


import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

import com.hongyu.smart.village.listener.OnItemClickListener;

import butterknife.ButterKnife;

public class BaseViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{

    private OnItemClickListener mOnItemClickListener;

    public BaseViewHolder(View itemView) {
        super(itemView);
        ButterKnife.bind(this, itemView);
        itemView.setOnClickListener(this);
    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        this.mOnItemClickListener = onItemClickListener;
    }

    @Override
    public void onClick(View view) {
        if (mOnItemClickListener != null) {
            mOnItemClickListener.onItemClick(getAdapterPosition());
        }
    }
}